package com.wiscamp.ninechapters.tags.application.assemblers;

import com.wiscamp.ninechapters.tags.application.dto.command.CreateSubjectCommand;
import com.wiscamp.ninechapters.tags.application.dto.command.UpdateSubjectCommand;
import com.wiscamp.ninechapters.tags.application.dto.vo.SubjectVO;
import com.wiscamp.ninechapters.tags.domain.models.Subject;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface SubjectAssembler {
    SubjectAssembler Instance = Mappers.getMapper(SubjectAssembler.class);

    SubjectVO toSubjectVO(Subject entity);

    Subject fromCreateCommand(CreateSubjectCommand command);

    Subject fromUpdateCommand(UpdateSubjectCommand command);

    Subject mergeUpdateCommand(UpdateSubjectCommand command, @MappingTarget Subject entity);
}
